package altfee.example;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Bundle2Activity extends Activity {

	String value;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.subview);

		Intent i = getIntent();
		Bundle b = i.getExtras();

		String v1 = b.getString("first");
		String v2 = b.getString("second");

		value = v1 + v2;

		Button button = (Button) findViewById(R.id.backToMainBtn);
		button.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				replyCalculation();
			}
		});
	}

	public void replyCalculation() {
		Intent i = new Intent();

		Bundle b = new Bundle();
		b.putString("CALCULATION", value);

		i.putExtras(b);

		this.setResult(AfConstants.BUNDLE_RESULT_2, i);
		this.finish();
		Log.v("tag", "finish");
	}
}
